import Vue from "vue";
import Vuex from "vuex";

import carts from "./cart/";
import Products from "./product";
import comment from "./comment";

Vue.use(Vuex);

export default new Vuex.Store({
  // namespaced: true,
  state: {
    username: "blw",
    userInfo: {},
  },
  getters: {},
  mutations: {
    CHANGE_USERNAME(state) {
      state.username = "鱿鱼洗";
    },
    SET_USERINFO(state, paylode) {
      state.userInfo = paylode;
    },
  },
  actions: {},
  modules: {
    carts,
    Products,
    comment,
    //插件
    // plugins:[createPersistedState({
    //   storage:windown.sessionStorage,
    //   key:'userInfo',
    //   paths:[]
    // })]
  },
  plugins: [],
});
